package com.slipper.system.flow.service;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.slipper.system.flow.bo.*;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;

import com.slipper.system.flow.dao.FlowLineCondDao;

import com.slipper.core.transaction.ReadTransactional;
import com.slipper.core.transaction.WriteTransactional;
import com.slipper.util.Tool;

@Service
@ReadTransactional
public class FlowLineCondService {
    @Resource
    private FlowLineCondDao flowLineCondDao;
    
    public FlowLineCondBO queryBy(String id) {
        return flowLineCondDao.queryBy(id);
    }
    
    public List<FlowLineCondBO> queryList(FlowLineCondBO bo) {
        return flowLineCondDao.queryList(bo);
    }
    
    public PageInfo<FlowLineCondBO> queryPage(FlowLineCondBO bo) {
        PageHelper.startPage(bo.getPageNumber(), bo.getPageSize());
        return new PageInfo<>(flowLineCondDao.queryList(bo));
    }
    
    @WriteTransactional
    public int save(FlowLineCondBO bo) {
        int result;
        if (bo.getId() != null && !"".equals(bo.getId())) {
            result = flowLineCondDao.update(bo);
        } else {
            bo.setId(Tool.getUUID());
            result = flowLineCondDao.insert(bo);
        }
        return result;
    }
    
    @WriteTransactional
    public int delete(FlowLineCondBO bo) {
        return flowLineCondDao.delete(bo);
    }
}
